package org.example.prototype;

import java.util.HashMap;
import java.util.Map;

/**
 * 工厂方法
 */
public class PrototypeFactory {
    static Map<String,IPrototype> map = new HashMap<>();
    static {
        map.put("media",new MediaPrototype());
        map.put("ebook",new EbookPrototype());
    }
    public IPrototype getPrototypeClone(String name) throws CloneNotSupportedException {
        return map.get(name).clone();
    }
}
